package br.com.foxinline.modelo;

import br.com.foxinline.enums.AtoImovel;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author cadomeireles
 */
@Entity
public class TipoAtoImovel implements Serializable {

    @Id
    @SequenceGenerator(name = "seq_tipo_ato_imovel", sequenceName = "seq_tipo_ato_imovel", allocationSize = 1)
    @GeneratedValue(generator = "seq_tipo_ato_imovel", strategy = GenerationType.SEQUENCE)

    private Long id;
    
    private boolean ativo;
    
    @Enumerated(EnumType.STRING)    
    private AtoImovel atoImovel;
    
    private String descricao;

    public TipoAtoImovel() {
        this.ativo = true;
    }

    public TipoAtoImovel(Long id, AtoImovel atoImovel, String descricao) {
        this.id = id;
        this.ativo = true;
        this.atoImovel = atoImovel;
        this.descricao = descricao;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public boolean isAtivo() {
        return ativo;
    }

    public void setAtivo(boolean ativo) {
        this.ativo = ativo;
    }

    public AtoImovel getAtoImovel() {
        return atoImovel;
    }

    public void setAtoImovel(AtoImovel atoImovel) {
        this.atoImovel = atoImovel;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 37 * hash + (this.ativo ? 1 : 0);
        hash = 37 * hash + (this.atoImovel != null ? this.atoImovel.hashCode() : 0);
        hash = 37 * hash + (this.descricao != null ? this.descricao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TipoAtoImovel other = (TipoAtoImovel) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.ativo != other.ativo) {
            return false;
        }
        if (this.atoImovel != other.atoImovel) {
            return false;
        }
        if ((this.descricao == null) ? (other.descricao != null) : !this.descricao.equals(other.descricao)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "TipoAtoImovel{" + "id=" + id + ", ativo=" + ativo + ", atoImovel=" + atoImovel + ", descricao=" + descricao + '}';
    }
}
